{extend name="home@common/home_layout" /}

{block name="title"}商品详情{/block}
{block name="style"}{/block}

{block name="content"}

	{include file="home@common/cur_local" /}
	
	<script type="text/javascript" src="__HOME_PATH__/js/mz-packed.js" charset="utf-8"></script>
	<script type="text/javascript" src="__HOME_PATH__/custom/js/Marquee.js" charset="utf-8"></script>
	<!--看了又看效果-->
	<script type="text/javascript">
	    $(function(){
	        //一次纵向滚动一个
	        $('#marquee2').kxbdSuperMarquee({
	            distance:160,
	            isAuto:false,
	            time:3,
	            btnGo:{up:'#goU',down:'#goD'},
	            direction:'down'
	        });
	    });
	
	</script>

	<!--[if IE 7]>
	  <link rel="stylesheet" href="__HOME_PATH__/font/font-awesome/css/font-awesome-ie7.min.css">
	<![endif]-->
	<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
	<!--[if lt IE 9]>
	      <script src="__RESOURCE_PATH__/js/html5shiv.js"></script>
	      <script src="__RESOURCE_PATH__/js/respond.min.js"></script>
	<![endif]-->
	<!--[if IE 6]>
	<script src="__RESOURCE_PATH__/js/IE6_PNG.js"></script>
	<script>
	DD_belatedPNG.fix('.pngFix');
	</script>

	<script>
	// <![CDATA[
	if((window.navigator.appName.toUpperCase().indexOf("MICROSOFT")>=0)&&(document.execCommand))
	try{
	document.execCommand("BackgroundImageCache", false, true);
	   }
	catch(e){}
	// ]]>
	</script>
	<![endif]-->

	<script>
		/*var COOKIE_PRE = '<?php echo COOKIE_PRE;?>';
		var _CHARSET = '<?php echo strtolower(CHARSET);?>';
		var LOGIN_SITE_URL = '<?php echo LOGIN_SITE_URL;?>';
		var MEMBER_SITE_URL = '<?php echo MEMBER_SITE_URL;?>';
		var SITEURL = '<?php echo SHOP_SITE_URL;?>';
		var SHOP_SITE_URL = '<?php echo SHOP_SITE_URL;?>';
		var RESOURCE_SITE_URL = '<?php echo RESOURCE_SITE_URL;?>';
		var RESOURCE_SITE_URL = '<?php echo RESOURCE_SITE_URL;?>';
		var SHOP_TEMPLATES_URL = '<?php echo SHOP_TEMPLATES_URL;?>';*/
	</script>
	<script src="__RESOURCE_PATH__/js/jquery.js"></script>
	<script src="__RESOURCE_PATH__/js/common.js" charset="utf-8"></script>
	<script src="__RESOURCE_PATH__/js/jquery-ui/jquery.ui.js"></script>
	<script src="__RESOURCE_PATH__/js/jquery.validation.min.js"></script>
	<script src="__RESOURCE_PATH__/js/jquery.masonry.js"></script>
	<script src="__RESOURCE_PATH__/js/dialog/dialog.js" id="dialog_js" charset="utf-8"></script>
	<script type="text/javascript">
		var PRICE_FORMAT = '￥%s';
		$(function(){
				$('a[nctype="search_in_store"]').click(function(){
				if ($('#inkeyword').val() == '') {
					return false;
				}
				$('#search_act').val('show_store');
				$('<input type="hidden" value="{$store_info['store_id']}" name="store_id" /> <input type="hidden" name="op" value="goods_all" />').appendTo("#formSearch");
				$('#formSearch').submit();
			});
			$('a[nctype="search_in_shop"]').click(function(){
				document.formSearch.keyword.value=document.formSearch.inkeyword.value;
				if ($('#inkeyword').val() == '') {
					return false;
				}
				$('#formSearch').submit();
			});
			$("#formSearch").keydown(function(e){
		         if(e.keyCode == 13){
					document.formSearch.keyword.value=document.formSearch.inkeyword.value;
					}
				});
			$('#inkeyword').css("color","#999999");
		  //店铺商品分类
		    $('#store_nav_class_button').on('mouseover', function() {
		        $('#store_nav_class_menu').show();
		    });
		    $('#store_nav_class_button').on('mouseout', function() {
		        $('#store_nav_class_menu').hide();
		    });
		    $('.store-nav-class-sub-menu').on('mouseover', function() {
		        $('.store-nav-class-menu-item').hide();
		        $(this).children('.store-nav-class-menu-item').show();
		    });
		    $('.store-nav-class-sub-menu').on('mouseout', function() {
		        $('.store-nav-class-menu-item').hide();
		    });
		});
  	</script>

	<link href="__HOME_PATH__/css/home_goods.css" rel="stylesheet" type="text/css">
	<link href="__HOME_PATH__/custom/css/font-family.css" rel="stylesheet" type="text/css">
	<link href="__HOME_PATH__/custom/css/goods.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="__HOME_PATH__/js/mz-packed.js" charset="utf-8"></script>
	<div class="wrapper pr">
  		<input type="hidden" id="lockcompare" value="unlock" />
  		<div class="ncs-detail{if ($store_info['is_own_shop'])} ownshop {/if}"> 
   			<!-- 焦点图 -->
	    <div id="ncs-goods-picture" class="ncs-goods-picture">
		    <div class="gallery_wrap">
		        <div class="gallery">
		        	<img title="鼠标滚轮向上或向下滚动，能放大或缩小图片哦~" src="{$goods_image['0']['1']}" class="cloudzoom" data-cloudzoom="zoomImage: '{$goods_image["0"]["2"]}'"> 
		        </div>
		    </div>
		    <div class="controller_wrap">
		        <div class="controller">
		          	<ul>
		          		{if (!empty($goods_image) && is_array($goods_image))}
			            	{foreach $goods_image as $key => $value}
				            	<li>
				            		<img title="鼠标滚轮向上或向下滚动，能放大或缩小图片哦~" class='cloudzoom-gallery' src="{$value['0']}" data-cloudzoom="useZoom: '.cloudzoom', image: '{$value['1']}', zoomImage: '{$value['2']}' " width="60" height="60">	
				            	</li>
			             	{/foreach}
		             	{/if}
		          	</ul>
		        </div>
		    </div>
		</div>
		<!-- //焦点图 -->

    	<!-- S 商品基本信息 -->
    	<div class="ncs-goods-summary">
      		<div class="name">
        		<h1>{$goods['goods_name']}</h1>
        		<strong>{:str_replace("\n", "<br>", $goods['goods_jingle'])}</strong> 
        	</div>
      		<div class="ncs-meta">
        		{if ($goods['is_book'] == 0)}
	        		<!-- S 商品参考价格 -->
			        <!--<dl>
			          <dt>市&nbsp;&nbsp;场&nbsp;&nbsp;价：</dt>
			          <dd class="cost-price"><strong>￥{$goods['goods_marketprice']}</strong></dd>
			        </dl>-->
	        		<!-- E 商品参考价格 --> 
	        		<!-- S 商品发布价格 -->
			        <dl class="good-price">
			        	<!--<div class="store-tag">-->
			        		<!--<img src="__HOME_PATH__/custom/images/icon/store-tag.png" alt="">-->
			        		<!--全商城实物商品通用-->
			        	<!--</div>-->
			          	<dt>价格：</dt>
			          	<dd class="price">
			            	{if (isset($goods['promotion_price']) && !empty($goods['promotion_price']))}
			            		<strong><i>￥</i>{$goods['promotion_price']}</strong>
			            		<em><i>￥</i>{$goods['goods_price']}</em>
			            	{else /}
			            		<strong><i>￥</i>{$goods['goods_price']}</strong>
			            	{/if}
			          	</dd>
			          	<!--<a class="guaquan" href="#">
			          		去刮券 <img src="__HOME_PATH__/custom/images/icon/quGuaQ.png" alt="">	
			          	</a>-->
			        </dl>
        			<!-- E 商品发布价格 -->
        		{else /}
        			<!-- 预定商品 -->
        
			        <!--<dl>
			          <dt><?php echo $lang['goods_index_goods_price'];?><?php echo $lang['nc_colon'];?></dt>
			          <dd class="cost-price"><strong><?php echo $lang['currency'].$output['goods']['goods_price'];?></strong></dd>
			        </dl>-->
			        
			        <dl class="good-price">
			          	<dt>预定价格：</dt>
			          	<dd class="price"><strong>￥{$goods['book_down_payment'] + floatval($goods['book_final_payment'])}</strong>
			          		<em>￥{$goods['goods_price']}</em>
			          	</dd>
			        </dl>
			        <div class="ncs-book-down">
			          	<div class="rule-price"><strong>定金</strong>￥{$goods['book_down_payment']}</div>
			          	<div class="rule-symbol">+</div>
			          	<div class="rule-price"><strong>尾款</strong>￥{$goods['book_final_payment']} </div>
			          	<div class="rule-info">
			          		<a href="javascript:void(0);">预定规则<i class="icon-question-sign"></i>
					            <ul>
					              	<span class="arrow"></span>
					              	<li>1.定金下单后，请在60分钟内付款，超时将自动关闭订单。</li>
					              	<li>2.定金付款后，若非商城或商家责任（根据《售后政策》和客服判断为准），定金恕不退还；</li>
					              	<li>3.预售结束时，由系统自动更新尾款价格，先下单后下单均能享受同样的价格。请至商城“我的订单”内付尾款；</li>
					              	<li>4.尾款开始付款后，请在要求的时间（1小时）内支付尾款，若超时将自动关闭订单，且定金不予退还。请注意预售的结束时间，并及时支付尾款；</li>
					              	<li>5.预售商品不支持7天无理由退换货；</li>
					              	<li>6.发货时间请以预定商品详情页“发货时间”描述为准。</li>
					            </ul>
			            	</a> 
			            </div>
			        </div>
			       	<div class="book">
				        <dl>
				          	<dt>预定人数：</dt>
				          	<dd><strong>{$goods['book_buyers']}</strong> 人</dd>
				        </dl>
				        <dl>
				          	<dt>预定结束：</dt>
				          	<dd>剩余<strong>{$remain['day']}</strong>天<strong>{$remain['hour']}</strong>时<strong>{$remain['minute']}</strong>分</dd>
				        </dl>
					</div>
         
        			<!-- 预定商品结束 -->
        		{/if}
      		</div>
      		
      		{if($goods['goods_state'] != 10 && $goods['goods_verify'] == 1)}
      			<!-- 促销 -->
     			{if (isset($goods['promotion_type']) || $goods['have_gift'] || !empty($goods['jjg_explain']) || !empty($mansong_info))}
      				<div class="ncs-sale">
      					{if (isset($goods['promotion_type']) || !empty($goods['jjg_explain']) || !empty($mansong_info))}
        					<dl>
					          	<dt>促&#12288;&#12288;销：</dt>
					          	<dd class="promotion-info">
						            {if (isset($goods['title']) && $goods['title'] != '')}
						            	<span class="sale-name">{$goods['title']}</span>
						            {/if}
						            <!-- S 限时折扣 -->
						            {if ($goods['promotion_type'] == 'xianshi')}
						            	<span class="sale-rule w400">直降<em>￥{$goods['down_price']}</em>
						            		{if($goods['lower_limit'])}
						            			{sprintf('最低%s件起，',$goods['lower_limit'])}{$goods['explain']}
						            		{/if}
						            	</span>
						            {/if}
						            <!-- E 限时折扣  --> 
						            <!-- S 抢购-->
						            {if ($goods['promotion_type'] == 'groupbuy')}
						            	{if ($goods['upper_limit'])}
						            		<em>{sprintf('最多限购%s件',$goods['upper_limit'])}</em>
						            	{/if}
						            	<span>{$goods['remark']}</span><br>
						            {/if}
						            <!-- E 抢购 --> 
						            <!--满就送开始 -->
						            {if($mansong_info)}
						            	<div class="ncs-mansong"> 
						            		<span class="sale-name">满即送</span> 
						            		<span class="sale-rule">
							              		{$rule = $mansong_info['rules'][0]}管理
							              		<em>￥{$rule['price']}</em>
							              		{if(!empty($rule['discount']))}
							              			 ，减<em>￥{$rule['discount']}</em>
							              		{/if}
								              	{if(!empty($rule['goods_id']))}
								              		，送礼品<a href="{$rule['goods_url']}" title="{$rule['mansong_goods_name']}" target="_blank">赠品</a>
								              	{/if}
						              		</span> 
						              		<span class="sale-rule-more" nctype="show-rule">
						              			<a href="javascript:void(0);">共<strong>{count($mansong_info']['rules'])}</strong>项，展开查看<i></i></a>
						              		</span>
						              		<div class="sale-rule-content" style="display: none;" nctype="rule-content">
						                		<div class="title">
						                			<span class="sale-name">满即送</span>共<strong>{count($mansong_info['rules'])}</strong>项，促销活动规则<a href="javascript:;" nctype="hide-rule">关闭</a>
						                		</div>
						                		<div class="content">
								                  	<div class="mjs-tit">{$mansong_info['mansong_name']}
								                    	<time>( 活动时间：{:date('Y-m-d',$mansong_info['start_time'])}--{:date('Y-m-d',$mansong_info['end_time'])} )</time>
								                  	</div>
									                <ul class="mjs-info">
									                    {foreach $mansong_info['rules'] as $rule}
									                    	<li> 
									                    		<span class="sale-rule">
									                    			满<em>￥{$rule['price']}</em>
									                      			{if(!empty($rule['discount']))}
									                      				， 减<em>￥{$rule['discount']}</em>
									                      			{/if}
									                      			{if(!empty($rule['goods_id']))}
									                      				， 送礼品 <a href="{$rule['goods_url']}" title="{$rule['mansong_goods_name']}" target="_blank" class="gift"> <img src="{cthumb($rule['goods_image'], 60)}" alt="{$rule['mansong_goods_name']}"> </a>&nbsp;。
									                      			{/if}
									                      		</span> 
									                    	</li>
									                    {/foreach}
									                </ul>
							                  		<div class="mjs-remark">{$mansong_info['remark']}</div>
							                	</div>
							                	<div class="bottom">
							                		<a href="{:url('shop/Showstore/mansong_goods',array('store_id' => $store_info['store_id']))}" class="url" target="_blank">查看更多店铺“满即送”活动商品</a>
							                	</div>
						              		</div>
						           	 	</div>
	            					{/if}
	            					<!--满就送结束--> 
	            					<!-- 加价购 开始-->
						            {if ($goods['jjg_explain'])}
						            	<div class="ncs-jjg"> 
						            		<span class="sale-name">加价购</span> 
						            		<span class="sale-rule">{$goods['jjg_explain']}</span> 
						            		<span nctype="show-rule" class="sale-rule-more">
						            			<a href="javascript:void(0);">共<strong>{count($goods['jjg_info']['levels'])}</strong>项，展开查看<i></i></a>
						            		</span>
						              		<div class="sale-rule-content" style="display: none;" nctype="rule-content">
						                		<div class="title">
						                			<span class="sale-name">加价购</span>共<strong>{count($goods['jjg_info']['levels'])}</strong>项，促销活动规则<a href="javascript:;" nctype="hide-rule">关闭</a>
						                		</div>
						                		<div class="cou-rule-list">
						                  			<div class="couRuleScrollbar">
									                    {php}$shownLevelSkus = array();{/php}
									                    {if !empty($goods['jjg_info']['levels']) && is_array($goods['jjg_info']['levels'])}
															{foreach $goods['jjg_info']['levels'] as $levelId => $v}
									                    		<div class="cou-rule">
										                      		<h4>
										                      			规则{$levelId}：消费满<strong>￥{$v['mincost']}</strong>
											                        	{if ($v['maxcou'] > 0)}
											                        		可换购最多<strong>{$v['maxcou']}</strong>种优惠商品
											                        	{else /}
											                        		可换购任意多种优惠商品
											                        	{/if}
											                      	</h4>
							                      					<ul>
							                      						{if is_array($goods['jjg_info']['levelSkus'][$levelId])}
								                        					{foreach $goods['jjg_info']['levelSkus'][$levelId] as $sku => $vv}
																				{php}$g = $goods['jjg_info']['items'][$sku];{/php}
																				{if (empty($g) || isset($shownLevelSkus[$sku]))}
																				    {php}continue;{/php}
																				{/if}
																				{php}$shownLevelSkus[$sku] = true;{/php}
														                        <li title="{$g['name']}">
														                        	<a target="_blank" href="{:url('shop/Goods/goods_detail',array('goods_id' => $sku))}"> 
														                        		<img alt="" src="{cthumb($g['goods_image'], 60)}"/>
														                          		<h5>{$g['name']}</h5>
														                          		<h6 title="换购价">￥{$vv['price']}</h6>
														                          	</a> 
														                        </li>
														                    {/foreach}
													                    {/if}
													            	</ul>
						                    					</div>
						                    				{/foreach}
						                    			{/if}
						                  			</div>
						                		</div>
						                		<div class="bottom">
						                			<a href="{:url('shop/Showstore/cou_goods')}?store_id={$store_info['store_id']}&cou_id={$goods['jjg_info']['info']['id']}" class="url" target="_blank">查看更多店铺“加价购”活动商品</a>
						                		</div>
						              		</div>
						            	</div>
						            {/if}
						            <!-- 加价购结束 --> 
          						</dd>
        					</dl>
        				{/if}
        				
        				<!-- 赠品开始 -->
        				{if ($goods['have_gift'])}
        					<hr/>
					        <dl>
					          	<dt>赠&#12288;&#12288;品：</dt>
					          	<dd class="goods-gift" id="ncsGoodsGift"> <span>数量有限，赠完为止。</span>
						            {if (!empty($gift_array))}
							            <ul>
							              	{foreach ($gift_array as $val)}
									            <li>
									                <div class="goods-gift-thumb">
									                	<span><img src="{cthumb($val['gift_goodsimage'], '60', $goods['store_id'])}"></span>
									                </div>
									                <a href="{:url('shop/Goods/goods_detail',array('goods_id' => $val['gift_goodsid']))}" class="goods-gift-name" target="_blank">{$val['gift_goodsname']}</a><em>x{$val['gift_amount']}</em> 
									            </li>
									        {/foreach}
							            </ul>
						            {/if}
					          	</dd>
					        </dl>
					    {/if}
        				<!-- 赠品结束 --> 
        
      				</div>
      			{/if}
      	
      	
      			<div class="ncs-logistics"><!--S 物流与运费新布局展示-->
			        {if ($goods['goods_state'] == 1 && $goods['goods_verify'] == 1 && $goods['is_virtual'] == 0)}
			        	<dl id="ncs-freight" class="ncs-freight">
			         		<dt>配&nbsp;&nbsp;送&nbsp;&nbsp;至：</dt>
			          		<dd class="ncs-freight_box">
			            		<div id="ncs-freight-selector" class="ncs-freight-select">
						            <div class="text">
						                <div>{$store_info['deliver_region'] ? str_replace(' ','',$store_info['deliver_region'][1]) : '请选择地区'}</div>
						                <b>∨</b> 
						            </div>
				              		<div class="content">
						                <div id="ncs-stock" class="ncs-stock" data-widget="tabs">
							                <div class="mt">
							                    <ul class="tab">
							                      	<li data-index="0" data-widget="tab-item" class="curr">
							                      		<a href="#none" class="hover"><em>{$store_info['deliver_region_names'][0] ? $store_info['deliver_region_names'][0] : '请选择'}</em><i> ∨</i></a>
							                      	</li>
							                    </ul>
							                </div>
						                  	<div id="stock_province_item" data-widget="tab-content" data-area="0">
						                    	<ul class="area-list"></ul>
						                  	</div>
						                  	<div id="stock_city_item" data-widget="tab-content" data-area="1" style="display: none;">
						                    	<ul class="area-list"></ul>
						                  	</div>
						                  	<div id="stock_area_item" data-widget="tab-content" data-area="2" style="display: none;">
						                    	<ul class="area-list"></ul>
						                  	</div>
						                </div>
				              		</div>
				              		<a href="javascript:;" class="close" onclick="$('#ncs-freight-selector').removeClass('hover')">关闭</a> 
			            		</div>
			            		<div id="ncs-freight-prompt"> <strong>{:$goods['goods_storage'] > 0 ? '有货' : '无货'}</strong>
					              {if (!$goods['transport_id'])}
					              	{:@$goods['goods_freight'] > 0 ? '运费：￥{$goods['goods_freight']}元' : '免运费'}
					              {/if}
			            		</div>
			          		</dd>
			        	</dl>
			        	<!--S 物流与运费新布局展示-->
			        {/if}
			        <!--S 门店自提 -->
			        {if($goods['is_chain'])}
				        <hr/>
				        <dl class="ncs-chain">
				          	<dt>门店服务：</dt>
				          	<dd>
				          		<i class="icon-chain"></i>
				          		<a href="javascript:void(0);" nctype="show_chain" data-goodsid="{$goods['goods_id']}">门店自提</a>· 选择有现货的门店下单，可立即提货
				          	</dd>
				        </dl>
			        {/if}
        			<!--E 门店自提end -->
    			</div>
      	

		        <dl class="rate">
		          	<!-- S 描述相符评分 -->
		          	<dd>
			          	<span>销量
			          		<i>{$goods['goods_salenum']}</i>
			          	</span>
			          	<span>
			          		<a href="#ncGoodsRate">累评价
			          			<i>{$goods['evaluation_count']}</i>
			          		</a>
			          	</span>
			          	<span class="star">评分
			          		<i class="raty" data-score="{$goods_evaluate_info['star_average']}"></i>
			          	</span>
		          	</dd>
		          	<!-- E 描述相符评分 -->
				</dl>
		      	<!-- E 促销 -->
      
      
      			<div class="ncs-key"> 
        
		        	<!-- S 商品规格值-->
		        	{if (is_array($goods['spec_name']))}
		        		<hr/>
		        		{foreach $goods['spec_name'] as $key => $val}
					        <dl nctype="nc-spec">
					          	<dt>{$val}：</dt>
					          	<dd>
					            	{if (is_array($goods['spec_value'][$key]) && !empty($goods['spec_value'][$key]))}
							            <ul nctyle="ul_sign">
							              	{foreach $goods['spec_value'][$key] as $k => $v}
								              	{if ($key == 1 )}
								              		<!-- 图片类型规格-->
								              		<li class="sp-img">
								              			<a href="javascript:void(0);" class="{if (isset($goods['goods_spec'][$k]))} hovered {/if}" data-param="{valid:{$k}}" title="{$v}">
								              				<img src="{$spec_image[$k]}"/>{$v}<i></i>
								              			</a>
								              		</li>
								              	{else /}
								              		<!-- 文字类型规格-->
								              		<li class="sp-txt">
								              			<a href="javascript:void(0)" class="{if (isset($goods['goods_spec'][$k]))} hovered {/if}" data-param="{valid:{$k}}">
								              				{$v}<i></i>
								              			</a>
								              		</li>
								              	{/if}
							              	{/foreach}
							            </ul>
							        {/if}
					         	</dd>
					        </dl>
		        		{/foreach}
		        	{/if}
		        	<!-- E 商品规格值-->
        	
		        	{if ($goods['is_virtual'] == 1)}
		        		<dl>
				          	<dt>提货方式：</dt>
				          	<dd>
				            	<ul>
					              	<li class="sp-txt">
					              		<a href="javascript:void(0)" class="hovered">电子兑换券<i></i></a>
					              	</li>
				            	</ul>
				          	</dd>
				        </dl>
				        <!-- 虚拟商品有效期 -->
				        <dl>
				          	<dt>有&nbsp;效&nbsp;期：</dt>
				          	<dd>即日起 到 {:date('Y-m-d H:i:s', $goods['virtual_indate'])}</dd>
				        </dl>
		        	{elseif ($goods['is_presell'] == 1)}
		        		<!-- 预售商品发货时间 -->
				        <dl>
				          	<dt>预&#12288;&#12288;售：</dt>
				          	<dd>
				            	<ul>
				              		<li class="sp-txt">
				              			<a href="javascript:void(0)" class="hovered">
				              				{:date('Y-m-d', $goods['presell_deliverdate'])}&nbsp;日发货<i></i>
				              			</a>
				              		</li>
				            	</ul>
				          	</dd>
				        </dl>
				        <!-- 预售商品发货时间 -->
		        	{/if}
		        	{if ($goods['is_fcode'])}
			        	<dl>
			          		<dt>购买类型：</dt>
				          	<dd>
				            	<ul>
				              		<li class="sp-txt">
				              			<a href="javascript:void(0)" class="hovered">F码优先购买<i></i></a>
				              		</li>
				            	</ul>
				          	</dd>
				        </dl>
		        	{/if}
		      	</div>
      
      
		      	<!-- S 购买数量及库存 -->
		      	<div class="ncs-buy">
		      		<div class="shuLiang">数量</div>
		      		
		        	{if ($goods['goods_state'] != 0 && $goods['goods_storage'] >= 0)}
				        <div class="ncs-figure-input">
				          	<input type="text" name="" id="quantity" value="1" size="3" maxlength="6" class="input-text" {if ($goods['is_fcode'] == 1)} readonly {/if}>
				          	<a href="javascript:void(0)" class="increase" {if ($goods['is_fcode'] != 1)}nctype="increase"{/if}>&nbsp;</a> 
				          	<a href="javascript:void(0)" class="decrease" {if ($goods['is_fcode'] != 1)}nctype="decrease"{/if}>&nbsp;</a> 
				        </div>
				        <div class="ncs-point" style="display: none;"><i></i> 
				          	<!-- S 库存 --> 
				          	<span>您选择的商品库存<strong nctype="goods_stock">{$goods['goods_storage']}</strong>件</span> 
				          	<!-- E 库存 --> 
				          	{if ($goods['is_virtual'] == 1 && $goods['virtual_limit'] > 0)} <!-- 虚拟商品限购数 -->
				          		<span class="look">，每人次限购<strong> 
				          			<!-- 虚拟抢购 设置了虚拟抢购限购数 该数小于原商品限购数 --> 
				          			{:($goods['promotion_type'] == 'groupbuy' && $goods['upper_limit'] > 0 && $goods['upper_limit'] < $goods['virtual_limit']) ? $goods['upper_limit'] : $goods['virtual_limit']} </strong>件商品。
				          		</span>
				          	{elseif ($goods['promotion_type'] == 'groupbuy' && $goods['upper_limit'] > 0)} <!-- 抢购限购 -->
				          		<span class="look">，每人次限购<strong> 
				          		{$goods['upper_limit']} </strong>件商品。</span>
				          	{/if}
				          	{if ($goods['is_fcode'] == 1)}
				          		<span class="look">，每个F码可优先购买一件商品。</span>
				          	{/if}
				        </div>
			        {/if}
		        
		        	<!-- S 提示已选规格及库存不足无法购买 -->
		        	{if ($goods['goods_state'] == 0 || $goods['goods_storage'] <= 0)}
		        		<div nctype="goods_prompt" class="ncs-point">
		        			<i></i> <span>您选择的商品<strong>库存不足</strong>；请选择店内其它商品或申请<a href="javascript:void(0);" nctype="arrival_notice" class="arrival" title="到货通知">到货通知</a>提示。</span> 
		        		</div>
		        	{/if}
		        	<!-- E 提示已选规格及库存不足无法购买 --> 
		        	<!-- S 购买按钮 -->
		        	<div class="ncs-btn">
				 		<!--限制购买-->
		          		{if ($IsHaveBuy=="0")}
		          
		          			{if ($goods['buynow'] == 1)}
		          				<!-- 立即购买--> 
		          				<a href="javascript:void(0);" nctype="buynow_submit" class="buynow {if ($goods['goods_state'] == 0 || $goods['goods_storage'] <= 0 || ($goods['is_virtual'] == 1 && $goods['virtual_indate'] < time()))}no-buynow{/if}" title="{$goods['buynow_text']}">{$goods['buynow_text']}</a>
		          			{/if}
					        {if ($goods['cart'] == 1)}
					          	<!-- 加入购物车--> 
					          	<a href="javascript:void(0);" nctype="addcart_submit" class="addcart {if ($goods['goods_state'] == 0 || $goods['goods_storage'] <= 0)}no-addcart{/if}" title="加入购物车">
					          		<i class="icon-shopping-cart"></i>加入购物车
					          	</a>
					        {/if}
			   			{/if}
			  			{if ($IsHaveBuy=="1")}
		          			<a href="javascript:void(0);" class="buynow no-buynow" title="您已参加本次抢购">您已参加本次抢购</a>
		          		{/if}
		          		<!-- S 加入购物车弹出提示框 -->
		          		<div class="ncs-cart-popup">
				            <dl>
				              	<dt>成功添加到购物车<a title="关闭" onClick="$('.ncs-cart-popup').css({'display':'none'});">X</a></dt>
				              	<dd>购物车共有 <strong id="bold_num"></strong> 种商品 总金额为：<em id="bold_mly" class="saleP"></em></dd>
				              	<dd class="btns">
				              		<a href="{:url('shop/Cart/index')}" class="ncbtn-mini ncbtn-mint">查看购物车</a> 
				              		<!--<a href="javascript:void(0);" class="ncbtn-mini ncbtn-mint" onClick="location.href='{:url(shop/Cart/index)}'">查看购物车</a> -->
				              		<a href="javascript:void(0);" class="ncbtn-mini" value="" onClick="$('.ncs-cart-popup').css({'display':'none'});">继续购物</a>
				              	</dd>
				            </dl>
				        </div>
		          		<!-- E 加入购物车弹出提示框 -->
		        	</div>
		        	<!-- E 购买按钮 --> 
		      	</div>
      
      			<!-- E 购买数量及库存 --> 
      
    		{else /}
		      	<div class="ncs-buy">
			        <div class="ncs-saleout">
			          	<dl>
			            	<dt style="width:200px"><i class="icon-info-sign"></i>商品已下架</dt>
			            	<dd>1.&nbsp;请联系卖家咨询</dd>
			            	<dd>2.&nbsp;逛逛&nbsp;<a href="{:url('shop/Showstore/index')}?store_id={$goods['store_id']}" class="ncbtn-mini">商家店铺</a>&nbsp;选择其他商品</dd>
			          	</dl>
			        </div>
			    </div>
		    {/if}
      		
      		<!-- S消费者保障服务 -->
      		{if($goods["contractlist"])}
			    <div class="ncs-cti">
			        <hr/>
			        <dl>
			          	<dt>服务承诺：</dt>
			          	<dd>
			            {foreach $goods["contractlist"] as $gcitem_k=>$gcitem_v)}
			            	<span {if($gcitem_v['cti_descurl'])}onclick="window.open('{$gcitem_v['cti_descurl']}');"{/if}> 
			            		<img src="{$gcitem_v['cti_icon_url_60']}"/>{$gcitem_v['cti_name']} 
			            	</span>
			            {/foreach}
			          	</dd>
			        </dl>
			    </div>
      		{/if}
      		<!-- E消费者保障服务 --> 
      	<!--E 商品信息 --> 
    	</div>
    	<!-- E 商品图片及收藏分享 -->
    	<div class="ncs-handle"> 
   
     		<!-- S 分享 --> 
      		<a href="javascript:void(0);" class="share" nc_type="sharegoods" data-param='{"gid":"{$goods['goods_id']}"}'>
      			<img src="__HOME_PATH__/custom/images/icon/store-share.png" alt="">
		      	分享
		      	<span>
		      		(<em nc_type="sharecount_{$goods['goods_id']}">{intval($goods['sharenum'])>0?intval($goods['sharenum']):0}</em>)
		      	</span>
      		</a> 
      		<!-- S 收藏 --> 
		    <a href="javascript:collect_goods('{$goods['goods_id']}','count','goods_collect');" class="favorite">
		      	<img src="__HOME_PATH__/custom/images/icon/store-collect.png" alt="">
		      	收藏商品
		      	<span>(<em nctype="goods_collect">{$goods['goods_collect']}</em>)</span>
		    </a> 
		    <!-- S 对比 --> 
		   <!--  <a href="javascript:void(0);" class="compare" nc_type="compare_{$goods['goods_id']}" data-param='{"gid":"{$goods['goods_id']}"}'><i></i>加入对比</a> -->
		    <!-- S 举报 -->
		    {if($inform_switch)}
		      <a href="{if (session('is_login'))}{url('home/MemberInform/inform_submit')}?goods_id={$goods['goods_id']}{else /}javascript:login_dialog();{/if}" title="举&nbsp;报" class="inform"><i></i>举&nbsp;报</a>
		    {/if}
		    <!-- End --> 
    	</div>
    	
    	<!--S 看了又看-->
	    <div class="store-marquee">
	        <h2>—— 看了又看 ——</h2>
	        <div id="marquee2">
	            <ul>
	            	{if (!empty($goods_rand_list) && is_array($goods_rand_list))}
		            	{foreach $goods_rand_list as $g}
				            <li>
				              	<a title="{$g['goods_name']}" href="{:url('shop/Goods/goods_detail')}?goods_id={$g['goods_id']}"> 
				              		<img width="140" height="120"  alt="" src="__UPLOAD_PATH__/shop/common/loading.gif" rel="lazy" data-url="{:FU_cthumb($g['goods_image'], 60)}" /> 
				              	</a>
				              	<p>￥{$g['goods_promotion_price']}</p>
				            </li>
				        {/foreach}
			        {/if}
	            </ul>
	        </div>
	        <div class="control">
	        	<a href="javascript:void(0);" id="goU"></a> 
	        	<a href="javascript:void(0);" id="goD"></a>
	        </div>
	    </div>
		<div class="clear"></div>
		<!--END 看了又看-->

 
	</div>
	
	<!-- S 优惠套装 -->
 	{if(!empty($goods_commend) && is_array($goods_commend) && count($goods_commend)>1)}
    	<div class="ncs-recommend">
	      	<div class="title">
	        	<h4>店铺热卖</h4>
	      	</div>
	      	<div class="content">
		        <ul>
		          	{foreach $goods_commend as $goods_commend}
		          		{if($goods['goods_id'] != $goods_commend['goods_id'])}
				          	<li>
					            <dl>
					              	<dt class="goods-name">
					              		<a href="{:url('shop/Goods/goods_detail')}?goods_id={$goods_commend['goods_id']}" target="_blank" title="{$goods_commend['goods_jingle']}">
					              			{$goods_commend['goods_name']}<em>{$goods_commend['goods_jingle']}</em>
					              		</a>
					              	</dt>
					              	<dd class="goods-pic">
					              		<a href="{:url('shop/Goods/goods_detail')}?goods_id={$goods_commend['goods_id']}" target="_blank" title="{$goods_commend['goods_jingle']}">
					              			<img src="__UPLOAD_PATH__/shop/common/loading.gif" data-url="{:FU_thumb($goods_commend, 240)}" rel="lazy" alt="{$goods_commend['goods_name']}"/>
					              		</a>
					              	</dd>
					              	<dd class="goods-price">￥{$goods_commend['goods_promotion_price']}</dd>
					            </dl>
				          	</li>
		          		{/if}
		          	{/foreach}
		        </ul>
		        <div class="clear"></div>
	      	</div>
    	</div>
    {/if}
	<div class="ncs-promotion" id="nc-bundling" style="display:none;"></div>
	
	<!-- E 优惠套装 -->
	<div id="content" class="ncs-goods-layout expanded" >
  		<div class="ncs-goods-main" id="main-nav-holder">
		    <div class="tabbar pngFix" id="main-nav">
		      	<div class="ncs-goods-title-nav">
			        <ul id="categorymenu">
			          	<li class="current">
			          		<a id="tabGoodsIntro" href="#content">商品详情</a>
			          	</li>
				        {if ($goods['is_virtual'] == 1)}
				          	<li><a id="tabStoreMap" href="#content">商家位置</a></li>
				        {/if}
				        <li>
				        	<a id="tabGoodsRate" href="#content">商品评价<em>({$goods['evaluation_count']})</em></a>
				        </li>
				        <li><a id="tabGoodsTraded" href="#content">销售记录<em>({$goods['goods_salenum']})</em></a></li>
				        <li><a id="tabGuestbook" href="#content">购买咨询</a></li>
				        <li class="qrcode">
				          	<i>手机购买</i>
				          	<img width="111" height="111" src="{:goodsQRCode($goods)}">
				        </li>
			        </ul>
			        <div class="switch-bar"><a href="javascript:void(0)" id="fold">&nbsp;</a></div>
		      	</div>
		    </div>
    		<div class="ncs-intro">
      			<div class="content bd" id="ncGoodsIntro">
			        {if(is_array($goods['goods_attr']) || isset($goods['brand_name']))}
			        	<ul class="nc-goods-sort" style="{if (!$goods['brand_name'])}border-bottom:0;{/if}">
				          	{if ($goods['goods_serial'])}
				          		<li>商家货号：{$goods['goods_serial']}</li>
				          	{/if}
					  		{if ($goods['brand_name'])}
				          		<li>品牌：{$goods['brand_name']}</li>
					  		{/if}
				          	{if(is_array($goods['goods_attr']) && !empty($goods['goods_attr']))}
				         		{foreach $goods['goods_attr'] as $val} 
				          			{php}$val= array_values($val);{/php}
				          			<li>{$val[0]}：{$val[1]}</li>
				          		{/foreach}
				          	{/if}
			          		{if (is_array($goods['goods_custom']))}
			            		{foreach $goods['goods_custom'] as $val}
					                {if ($val['value']!= '')}
					                    <li>{$val['name']}：{$val['value']}</li>
					                {/if}
			            		{/foreach}
				            {/if}
				        </ul>
			        {/if}
			        <div class="ncs-goods-info-content">{$goods['goods_body']}</div>
			    </div>
    		</div>
    		{if ($goods['is_virtual'] == 1)}
    			<!-- S 店铺地址地图 -->
			    <div class="ncs-shop-map">
			      	<div class="ncs-goods-title-bar hd">
			        	<h4><a href="javascript:void(0);">商家位置</a></h4>
			      	</div>
			      	<div class="bd" id="ncStoreMap" style="border: solid #E6E6E6; border-width: 0 1px 1px; margin-bottom: 20px; display:none; overflow: hidden;"> </div>
			    </div>
    			<!-- E 店铺地址地图 -->
    		{/if}
    		<div class="ncs-comment">
			    <div class="ncs-goods-title-bar hd">
			        <h4><a href="javascript:void(0);">商品评价</a></h4>
			    </div>
      			<div class="ncs-goods-info-content bd" id="ncGoodsRate">
			        <div class="top">
			          	<div class="rate">
			            	<p><strong>{$goods_evaluate_info['good_percent']}</strong><sub>%</sub>好评</p>
			            	<span>共有{$goods_evaluate_info['all']}人参与评分</span>
			          	</div>
			          	<div class="percent">
				            <dl>
				              	<dt>好评<em>({$goods_evaluate_info['good_percent']}%)</em></dt>
				              	<dd><i style="width: {$goods_evaluate_info['good_percent']}%"></i></dd>
				            </dl>
				            <dl>
				              	<dt>中评<em>({$goods_evaluate_info['normal_percent']}%)</em></dt>
				              	<dd><i style="width: {$goods_evaluate_info['normal_percent']}%"></i></dd>
				            </dl>
				            <dl>
				              	<dt>差评<em>({$goods_evaluate_info['bad_percent']}%)</em></dt>
				              	<dd><i style="width: {$goods_evaluate_info['bad_percent']}%"></i></dd>
				            </dl>
			          	</div>
			          	<div class="btns"><span>您可对已购商品进行评价</span>
			            	<p><a href="{if ($goods['is_virtual'])} {:url('member/Vrorder/index')} {else /} {:url('member/MemberOrder/index')} {/if}" class="ncbtn ncbtn-grapefruit" target="_blank"><i class="icon-comment-alt"></i>评价商品</a></p>
			          	</div>
			        </div>
			        <div class="ncs-goods-title-nav">
			          	<ul id="comment_tab">
				            <li data-type="all" class="current"><a href="javascript:void(0);">商品评价({$goods_evaluate_info['all']})</a></li>
				            <li data-type="1"><a href="javascript:void(0);">好评({$goods_evaluate_info['good']})</a></li>
				            <li data-type="2"><a href="javascript:void(0);">中评({$goods_evaluate_info['normal']})</a></li>
				            <li data-type="3"><a href="javascript:void(0);">差评({$goods_evaluate_info['bad']})</a></li>
				            <li data-type="4"><a href="javascript:void(0);">有图({$goods_evaluate_info['img']})</a></li>
			          	</ul>
			        </div>
			        <!-- 商品评价内容部分 -->
			        <div id="goodseval" class="ncs-commend-main"></div>
      			</div>
    		</div>
    		<div class="ncg-salelog">
			    <div class="ncs-goods-title-bar hd">
			        <h4><a href="javascript:void(0);">销售记录</a></h4>
			    </div>
			    <div class="ncs-goods-info-content bd" id="ncGoodsTraded">
			        <div class="top">
			          	<div class="price">商&nbsp;&nbsp;城&nbsp;&nbsp;价<strong>{$goods['goods_price']}</strong>元<span>购买的价格不同可能是由于店铺往期促销活动引起的，详情可以咨询卖家</span></div>
			        </div>
			        <!-- 成交记录内容部分 -->
			        <div id="salelog_demo" class="ncs-loading"> </div>
			    </div>
			</div>
		    <div class="ncs-consult">
		      	<div class="ncs-goods-title-bar hd">
		        	<h4><a href="javascript:void(0);">购买咨询</a></h4>
		      	</div>
		      	<div class="ncs-goods-info-content bd" id="ncGuestbook"> 
		        	<!-- 咨询留言内容部分 -->
		        	<div id="consulting_demo" class="ncs-loading"> </div>
		      	</div>
		    </div>
    		{if(!empty($goods_commend) && is_array($goods_commend) && count($goods_commend)>1)}
			    <div class="ncs-recommend">
			      	<div class="title">
			        	<h4>推荐商品</h4>
			      	</div>
			      	<div class="content">
				        <ul>
				          	{foreach $goods_commend as $goods_commend}
				          		{if($goods['goods_id'] != $goods_commend['goods_id'])}
				          			<li>
							            <dl>
							              	<dt class="goods-name">
							              		<a href="{:url('shop/Goods/goods_detail')}?goods_id={$goods_commend['goods_id']}" target="_blank" title="{$goods_commend['goods_jingle']}">{$goods_commend['goods_name']}<em><?php echo $goods_commend['goods_jingle'];?></em></a>
							              	</dt>
							              	<dd class="goods-pic">
							              		<a href="{:url('shop/Goods/goods_detail')}?goods_id={$goods_commend['goods_id']}" target="_blank" title="{$goods_commend['goods_jingle']}"><img src="__UPLOAD_PATH__/shop/common/loading.gif" rel="lazy" data-url="{:FU_thumb($goods_commend, 240)}" alt="{$goods_commend['goods_name']}"/></a>
							              	</dd>
							              	<dd class="goods-price">￥{$goods_commend['goods_promotion_price']}</dd>
							            </dl>
							        </li>
				          		{/if}
				          	{/foreach}
				        </ul>
				        <div class="clear"></div>
			      	</div>
			    </div>
    		{/if}
  		</div>
  
		<div class="ncs-sidebar">
		  	include template('store/info')
			<a href="javascript:collect_store('{$goods['store_id']}','count','store_collect')">
				<img src="__HOME_PATH__/custom/images/guanGaoTu/store-collect.jpg" alt="">	
			</a>
			
		    include template('store/callcenter')
		    
		    {if ($left_bar_type_mall_related)}
		        include template('store/left_mall_related')
		    {else /}
		        include template('store/left')
		    {/if}
		    {if ($viewed_goods)}
		    	<!-- 最近浏览 -->
		    	<div class="ncs-sidebar-container ncs-top-bar">
				    <div class="title">
				        <h4>最近浏览</h4>
				    </div>
		      		<div class="content">
				        <div id="hot_sales_list" class="ncs-top-panel">
				          	<ol>
				          		{if (!empty($viewed_goods) && is_array($viewed_goods))}
						            {foreach $viewed_goods as $g}
							            <li>
							              	<dl>
							                	<dt><a href="{:url('shop/Goods/goods_detail')}?goods_id={$g['goods_id']}">{$g['goods_name']}</a></dt>
							                	<dd class="goods-pic">
							                		<a href="{:url('shop/Goods/goods_detail')}?goods_id={$g['goods_id']}">
							                			<span class="thumb size60">
							                				<i></i><img src="{FU_thumb($g, 60)}"  onload="javascript:DrawImage(this,60,60);">
							                			</span>
							                		</a>
							                 		<p>
							                 			<span class="thumb size100">
							                 				<i></i><img src="{FU_thumb($g, 240)}" onload="javascript:DrawImage(this,100,100);" title="{$g['goods_name']}"><big></big><small></small>
							                 			</span>
							                 		</p>
							                	</dd>
							                	<dd class="price pngFix">{$g['goods_promotion_price']}</dd>
							              	</dl>
							            </li>
						            {/foreach}
					            {/if}
				          	</ol>
				        </div>
				        <p>
				        	<a href="{:url('member/Goodsbrowse/index')}" class="nch-sidebar-all-viewed">全部浏览历史</a>
				        </p> 
		        	</div>
		    	</div>
		    {/if}
		</div>
	</div>
</div>
<form id="buynow_form" method="post" action="{:url('home/Index/index')}">
  	<input id="act" name="act" type="hidden" value="buy" />
  	<input id="op" name="op" type="hidden" value="buy_step1" />
  	<input id="cart_id" name="cart_id[]" type="hidden"/>
</form>

<script type="text/javascript" src="__RESOURCE_PATH__/js/jquery.charCount.js"></script> 
<script src="__RESOURCE_PATH__/js/jquery.ajaxContent.pack.js" type="text/javascript"></script> 
<script src="__RESOURCE_PATH__/js/sns.js" type="text/javascript" charset="utf-8"></script> 
<script src="__RESOURCE_PATH__/js/jquery.F_slider.js" type="text/javascript" charset="utf-8"></script> 
<script type="text/javascript" src="__RESOURCE_PATH__/js/waypoints.js"></script> 
<script type="text/javascript" src="__RESOURCE_PATH__/js/jquery.raty/jquery.raty.min.js"></script> 
<script type="text/javascript" src="__RESOURCE_PATH__/js/jquery.nyroModal/custom.min.js" charset="utf-8"></script>
<link href="__RESOURCE_PATH__/js/jquery.nyroModal/styles/nyroModal.css" rel="stylesheet" type="text/css" id="cssfile2" />
<script type="text/javascript">
	//产品图片
	jQuery(function($){
		// 放大镜效果 产品图片
     	CloudZoom.quickStart();
     
	    // 图片切换效果
        $(".controller li").first().addClass("current");
        $(".controller").find("li").mouseover(function(){
        	$(this).first().addClass("current").siblings().removeClass("current");
        });
	});
	
	
	
	
	
</script>


<script type="text/javascript">


    //收藏分享处下拉操作
    jQuery.divselect = function(divselectid,inputselectid) {
      var inputselect = $(inputselectid);
      $(divselectid).mouseover(function(){
          var ul = $(divselectid+" ul");
          ul.slideDown("fast");
          if(ul.css("display")=="none"){
              ul.slideDown("fast");
          }
      });
      $(divselectid).live("mouseleave",function(){
          $(divselectid+" ul").hide();
      });
    };
$(function(){
	//赠品处滚条
	$('#ncsGoodsGift').perfectScrollbar({suppressScrollX:true});
    {if ($goods['goods_state'] == 1 && $goods['goods_storage'] > 0)}
	    // 加入购物车
	    $('a[nctype="addcart_submit"]').click(function(){
	    	if (typeof(allow_buy) != 'undefined' && allow_buy === false) return ;
	        addcart({$goods['goods_id']}, checkQuantity(),'addcart_callback');
	    });
        {if (!($goods['is_virtual'] == 1 && $goods['virtual_indate'] < time()))}
	        // 立即购买
	        $('a[nctype="buynow_submit"]').click(function(){
	        	if (typeof(allow_buy) != 'undefined' && allow_buy === false) return ;
	            buynow({$goods['goods_id']},checkQuantity());
	        });
        {/if}
    {/if}
    // 到货通知
    {if ($goods['goods_storage'] == 0 || $goods['goods_state'] == 0)}
	    $('a[nctype="arrival_notice"]').click(function(){
	        {if (session('is_login') !== '1')}
	        	login_dialog();
	        {else /}
	        	ajax_form('arrival_notice', '到货通知','{:url("shop/Goods/arrival_notice")}?goods_id={$goods['goods_id']}', 350);
	        {/if}
	    });
    {/if}
    //浮动导航  waypoints.js
    $('#main-nav').waypoint(function(event, direction) {
        $(this).parent().parent().parent().toggleClass('sticky', direction === "down");
        event.stopPropagation();
    });

    // 分享收藏下拉操作
    $.divselect("#handle-l");
    $.divselect("#handle-r");

    // 规格选择
    $('dl[nctype="nc-spec"]').find('a').each(function(){
        $(this).click(function(){
            if ($(this).hasClass('hovered')) {
                return false;
            }
            $(this).parents('ul:first').find('a').removeClass('hovered');
            $(this).addClass('hovered');
            checkSpec();
        });
    });

});

function checkSpec() {
    var spec_param = {$spec_list};
    var spec = new Array();
    $('ul[nctyle="ul_sign"]').find('.hovered').each(function(){
        var data_str = ''; eval('data_str =' + $(this).attr('data-param'));
        spec.push(data_str.valid);
    });
    spec1 = spec.sort(function(a,b){
        return a-b;
    });
    var spec_sign = spec1.join('|');
    $.each(spec_param, function(i, n){
        if (n.sign == spec_sign) {
            window.location.href = n.url;
        }
    });
}

// 验证购买数量
function checkQuantity(){
    var quantity = parseInt($("#quantity").val());
    if (quantity < 1) {
        alert("请填写购买数量");
        $("#quantity").val('1');
        return false;
    }
    max = parseInt($('[nctype="goods_stock"]').text());
    {if ($goods['is_virtual'] == 1 && $goods['virtual_limit'] > 0)}
    	max = {$goods['virtual_limit']};
	    if(quantity > max){
	        alert('最多限购'+max+'件');
	        return false;
	    }
    {/if}
    {if (!empty($goods['upper_limit']))}
	    max = {$goods['upper_limit']};
	    if(quantity > max){
	        alert('最多限购'+max+'件');
	        return false;
	    }
    {/if}
    if(quantity > max){
        alert("库存不足");
        return false;
    }
    return quantity;
}

// 立即购买js
function buynow(goods_id,quantity,chain_id,area_id,area_name,area_id_2){
	{if (session('is_login') !== '1')}
		login_dialog();
	{else /}
	    if (!quantity) {
	        return;
	    }
    	{if (session('store_id') == $goods['store_id'])}
    		alert('不能购买自己店铺的商品');return;
    	{/if}
    	$("#cart_id").val(goods_id+'|'+quantity);
		if (typeof chain_id == 'number') {
			$('#buynow_form').append('<input type="hidden" name="ifchain" value="1"><input type="hidden" name="chain_id" value="'+chain_id+'"><input type="hidden" name="area_id" value="'+area_id+'"><input type="hidden" name="area_name" value="'+area_name+'"><input type="hidden" name="area_id_2" value="'+area_id_2+'">');
		}
   		$("#buynow_form").submit();
	{/if}
}

$(function(){
    //选择地区查看运费
    $('#transport_pannel>a').click(function(){
    	var id = $(this).attr('nctype');
    	if (id=='undefined') return false;
    	var _self = this,tpl_id = '{$goods['transport_id']}';
	    var url = '{:url("shop/Goods/calc")}?rand='+Math.random();
	    $('#transport_price').css('display','none');
	    $('#loading_price').css('display','');
	    $.getJSON(url, {'id':id,'tid':tpl_id}, function(data){
	    	if (data == null) return false;
	        if(data != 'undefined') {$('#nc_kd').html('运费：<em>' + data + '</em>元');}else{'卖家承担运费';}
	        $('#transport_price').css('display','');
	    	$('#loading_price').css('display','none');
	        $('#ncrecive').html($(_self).html());
	    });
    });
    $("#nc-bundling").load('{:url("shop/Goods/get_bundling")}?goods_id={$goods['goods_id']}', function(){
        if($(this).html() != '') {
            $(this).show();
        }
    });
    {if ($goods['is_virtual'] == 1)}
	    $("#ncStoreMap").load('{:url("shop/ShowMap/index")}?w=600&h=400&store_id={$goods['store_id']}', function(){
	        if($(this).html() != '') {
	            $(this).show();
	        }
	    });
    {/if}
    $("#salelog_demo").load('{:url("shop/Goods/salelog")}?goods_id={$goods['goods_id']}&store_id={$goods['store_id']}&vr={$goods['is_virtual']}', function(){
        // Membership card
        $(this).find('[nctype="mcard"]').membershipCard({type:'shop'});
    });
	$("#consulting_demo").load('{:url("shop/Goods/consulting")}?goods_id={$goods['goods_id']}&store_id={$goods['store_id']}', function(){
		// Membership card
		$(this).find('[nctype="mcard"]').membershipCard({type:'shop'});
	});

/** goods.php **/
	// 商品内容部分折叠收起侧边栏控制
	$('#fold').click(function(){
  		$('.ncs-goods-layout').toggleClass('expanded');
	});
	// 商品内容介绍Tab样式切换控制
	$('#categorymenu').find("li").click(function(){
		$('#categorymenu').find("li").removeClass('current');
		$(this).addClass('current');
	});
	// 商品详情默认情况下显示全部
	$('#tabGoodsIntro').click(function(){
		$('.bd').css('display','');
		$('.hd').css('display','');
	});
	// 点击地图隐藏其他以及其标题栏
	$('#tabStoreMap').click(function(){
		$('.bd').css('display','none');
		$('#ncStoreMap').css('display','');
		$('.hd').css('display','none');
	});
	// 点击评价隐藏其他以及其标题栏
	$('#tabGoodsRate').click(function(){
		$('.bd').css('display','none');
		$('#ncGoodsRate').css('display','');
		$('.hd').css('display','none');
	});
	// 点击成交隐藏其他以及其标题
	$('#tabGoodsTraded').click(function(){
		$('.bd').css('display','none');
		$('#ncGoodsTraded').css('display','');
		$('.hd').css('display','none');
	});
	// 点击咨询隐藏其他以及其标题
	$('#tabGuestbook').click(function(){
		$('.bd').css('display','none');
		$('#ncGuestbook').css('display','');
		$('.hd').css('display','none');
	});
	//商品排行Tab切换
	$(".ncs-top-tab > li > a").mouseover(function(e) {
		if (e.target == this) {
			var tabs = $(this).parent().parent().children("li");
			var panels = $(this).parent().parent().parent().children(".ncs-top-panel");
			var index = $.inArray(this, $(this).parent().parent().find("a"));
			if (panels.eq(index)[0]) {
				tabs.removeClass("current ").eq(index).addClass("current ");
				panels.addClass("hide").eq(index).removeClass("hide");
			}
		}
	});
	//信用评价动态评分打分人次Tab切换
	$(".ncs-rate-tab > li > a").mouseover(function(e) {
		if (e.target == this) {
			var tabs = $(this).parent().parent().children("li");
			var panels = $(this).parent().parent().parent().children(".ncs-rate-panel");
			var index = $.inArray(this, $(this).parent().parent().find("a"));
			if (panels.eq(index)[0]) {
				tabs.removeClass("current ").eq(index).addClass("current ");
				panels.addClass("hide").eq(index).removeClass("hide");
			}
		}
	});

//触及显示缩略图
	$('.goods-pic > .thumb').hover(
		function(){
			$(this).next().css('display','block');
		},
		function(){
			$(this).next().css('display','none');
		}
	);

	/* 商品购买数量增减js */
	// 增加
	$('a[nctype="increase"]').click(function(){
		num = parseInt($('#quantity').val());
	    {if ($goods['is_virtual'] == 1 && $goods['virtual_limit'] > 0)}
		    max = <?php echo $output['goods']['virtual_limit'];?>;
		    if(num >= max){
		        alert('最多限购'+max+'件');
		        return false;
		    }
	    {/if}
	    {if (!empty($goods['upper_limit']))}
		    max = {$goods['upper_limit']};
		    if(num >= max){
		        alert('最多限购'+max+'件');
		        return false;
		    }
	    {/if}
		max = parseInt($('[nctype="goods_stock"]').text());
		if(num < max){
			$('#quantity').val(num+1);
		}
	});
	//减少
	$('a[nctype="decrease"]').click(function(){
		num = parseInt($('#quantity').val());
		if(num > 1){
			$('#quantity').val(num-1);
		}
	});

    //评价列表
    $('#comment_tab').on('click', 'li', function() {
        $('#comment_tab li').removeClass('current');
        $(this).addClass('current');
        load_goodseval($(this).attr('data-type'));
    });
    load_goodseval('all');
    function load_goodseval(type) {
        var url = '{:url("shop/Goods/comments")}?goods_id={$goods['goods_id']}';
        url += '&type=' + type;
        $("#goodseval").load(url, function(){
            $(this).find('[nctype="mcard"]').membershipCard({type:'shop'});
        });
    }

    //记录浏览历史
	$.get("{:url('shop/Goods/addbrowse')}",{gid:{$goods['goods_id']}});
	//初始化对比按钮
	initCompare();

    $('[nctype="show_chain"]').click(function(){
        _goods_id = $(this).attr('data-goodsid');
        ajax_form('show_chain', '查看门店', '{:url("shop/Goods/show_chain")}?goods_id=' + _goods_id, 640);
    });

    {if ($goods['jjg_explain'])}
        $('.couRuleScrollbar').perfectScrollbar({suppressScrollX:true});
    {/if}

    // 满即送、加价购显示隐藏
    $('[nctype="show-rule"]').click(function(){
        $(this).parent().find('[nctype="rule-content"]').show();
    });
    $('[nctype="hide-rule"]').click(function(){
        $(this).parents('[nctype="rule-content"]:first').hide()
    });

    $('.ncs-buy').bind({
        mouseover:function(){$(".ncs-point").show();},
        mouseout:function(){$(".ncs-point").hide();}
    });
    
});

/* 加入购物车后的效果函数 */
function addcart_callback(data){
	$('#bold_num').html(data.num);
    $('#bold_mly').html(price_format(data.amount));
    $('.ncs-cart-popup').fadeIn('fast');
}

{if($goods['goods_state'] == 1 && $goods['goods_verify'] == 1 && $goods['is_virtual'] == 0 && $goods['goods_storage'] > 0)}
	var $cur_area_list,$cur_tab,next_tab_id = 0,cur_select_area = [],calc_area_id = '',calced_area = [],cur_select_area_ids = [];
	$(document).ready(function(){
		$("#ncs-freight-selector").hover(function() {
			//如果店铺没有设置默认显示区域，马上异步请求
			<?php if (!$output['store_info']['deliver_region']) { ?>
			if (typeof nc_a === "undefined") {
		 		$.getJSON("{:url('shop/Index/json_area')}?callback=?", function(data) {
		 			nc_a = data;
		 			$cur_tab = $('#ncs-stock').find('li[data-index="0"]');
		 			_loadArea(0);
		 		});
			}
			<?php } ?>
			$(this).addClass("hover");
			$(this).on('mouseleave',function(){
				$(this).removeClass("hover");
			});
		});

		$('ul[class="area-list"]').on('click','a',function(){
			$('#ncs-freight-selector').unbind('mouseleave');
			var tab_id = parseInt($(this).parents('div[data-widget="tab-content"]:first').attr('data-area'));
			if (tab_id == 0) {cur_select_area = [];cur_select_area_ids = []};
			if (tab_id == 1 && cur_select_area.length > 1) {
				cur_select_area.pop();
				cur_select_area_ids.pop();
				if (cur_select_area.length > 1) {
					cur_select_area.pop();
					cur_select_area_ids.pop();
				}
			}
			next_tab_id = tab_id + 1;
			var area_id = $(this).attr('data-value');
			$cur_tab = $('#ncs-stock').find('li[data-index="'+tab_id+'"]');
			$cur_tab.find('em').html($(this).html());
			$cur_tab.find('i').html(' ∨');
			if (tab_id < 2) {
				calc_area_id = area_id;
				cur_select_area.push($(this).html());
				cur_select_area_ids.push(area_id);
				$cur_tab.find('a').removeClass('hover');
				$cur_tab.nextAll().remove();
				if (typeof nc_a === "undefined") {
	    	 		$.getJSON("{:url('shop/Index/json_area')}?callback=?", function(data) {
	    	 			nc_a = data;
	    	 			_loadArea(area_id);
	    	 		});
				} else {
					_loadArea(area_id);
				}
			} else {
				//点击第三级，不需要显示子分类
				if (cur_select_area.length == 3) {
					cur_select_area.pop();
					cur_select_area_ids.pop();
				}
				cur_select_area.push($(this).html());
				cur_select_area_ids.push(area_id);
				$('#ncs-freight-selector > div[class="text"] > div').html(cur_select_area.join(''));
				$('#ncs-freight-selector').removeClass("hover");
				_calc();
			}
			$('#ncs-stock').find('li[data-widget="tab-item"]').on('click','a',function(){
				var tab_id = parseInt($(this).parent().attr('data-index'));
				if (tab_id < 2) {
					$(this).parent().nextAll().remove();
					$(this).addClass('hover');
					$('#ncs-stock').find('div[data-widget="tab-content"]').each(function(){
						if ($(this).attr("data-area") == tab_id) {
							$(this).show();
						} else {
							$(this).hide();
						}
					});
				}
			});
		});
		function _loadArea(area_id){
			if (nc_a[area_id] && nc_a[area_id].length > 0) {
				$('#ncs-stock').find('div[data-widget="tab-content"]').each(function(){
					if ($(this).attr("data-area") == next_tab_id) {
						$(this).show();
						$cur_area_list = $(this).find('ul');
						$cur_area_list.html('');
					} else {
						$(this).hide();
					}
				});
				var areas = [];
				areas = nc_a[area_id];
				for (i = 0; i < areas.length; i++) {
					if (areas[i][1].length > 8) {
						$cur_area_list.append("<li class='longer-area'><a data-value='" + areas[i][0] + "' href='#none'>" + areas[i][1] + "</a></li>");
					} else {
					    $cur_area_list.append("<li><a data-value='" + areas[i][0] + "' href='#none'>" + areas[i][1] + "</a></li>");
					}
				}
				if (area_id > 0){
					$cur_tab.after('<li data-index="' + (next_tab_id) + '" data-widget="tab-item"><a class="hover" href="#none" ><em>请选择</em><i> ∨</i></a></li>');
				}
			} else {
				//点击第一二级时，已经到了最后一级
				$cur_tab.find('a').addClass('hover');
				$('#ncs-freight-selector > div[class="text"] > div').html(cur_select_area);
				$('#ncs-freight-selector').removeClass("hover");
				_calc();
			}
		}
		//计算运费，是否配送
		function _calc() {
			$.cookie('dregion', cur_select_area_ids.join(' ')+'|'+cur_select_area.join(' '), { expires: 30 });
			<?php if (! $output['goods']['transport_id']) { ?>
			return;
			<?php } ?>
			var _args = "&tid=<?php echo $output['goods']['transport_id']?>&area_id=" + calc_area_id;
			if (typeof calced_area[calc_area_id] == 'undefined') {
				//需要请求配送区域设置
				$.getJSON(SITEURL + "/index.php?act=goods&op=calc&" + _args + "&myf=<?php echo $output['store_info']['store_free_price']?>&callback=?", function(data){
					allow_buy = data.total ? true : false;
					calced_area[calc_area_id] = data.total;
					if (data.total === false) {
						$('#ncs-freight-prompt > strong').html('无货').next().remove();
						$('a[nctype="buynow_submit"]').addClass('no-buynow');
						$('a[nctype="addcart_submit"]').addClass('no-buynow');
					} else {
						$('#ncs-freight-prompt > strong').html('有货 ').next().remove();
						$('#ncs-freight-prompt > strong').after('<span>' + data.total + '</span>');
						$('a[nctype="buynow_submit"]').removeClass('no-buynow');
						$('a[nctype="addcart_submit"]').removeClass('no-buynow');
					}
				});	
			} else {
				if (calced_area[calc_area_id] === false) {
					$('#ncs-freight-prompt > strong').html('无货').next().remove();
					$('a[nctype="buynow_submit"]').addClass('no-buynow');
					$('a[nctype="addcart_submit"]').addClass('no-buynow');
				} else {
					$('#ncs-freight-prompt > strong').html('有货 ').next().remove();
					$('#ncs-freight-prompt > strong').after('<span>' + calced_area[calc_area_id] + '</span>');
					$('a[nctype="buynow_submit"]').removeClass('no-buynow');
					$('a[nctype="addcart_submit"]').removeClass('no-buynow');
				}
			}
		}
		//如果店铺设置默认显示配送区域
		{if ($store_info['deliver_region'])}
			if (typeof nc_a === "undefined") {
		 		$.getJSON("{:url('shop/Index/json_area')}?callback=?", function(data) {
		 			nc_a = data;
		 			$cur_tab = $('#ncs-stock').find('li[data-index="0"]');
		 			_loadArea(0);
		 			$('ul[class="area-list"]').find('a[data-value="<?php echo $output['store_info']['deliver_region_ids'][0]?>"]').click();
		 		    <?php if ($output['store_info']['deliver_region_ids'][1]) { ?>
		 			$('ul[class="area-list"]').find('a[data-value="<?php echo $output['store_info']['deliver_region_ids'][1]?>"]').click();
		 		    <?php } ?>
		  		    <?php if ($output['store_info']['deliver_region_ids'][2]) { ?>
		 			$('ul[class="area-list"]').find('a[data-value="<?php echo $output['store_info']['deliver_region_ids'][2]?>"]').click();
		 			<?php } ?>
		 		});
			}
		{/if}
	});
{/if}
</script> 

	
	


{/block}

{block name="script"}{/block}